﻿<%@ Page Language="C#" MasterPageFile="~/TownshipEnterprise/Town.master" AutoEventWireup="true" StylesheetTheme="Content"
 CodeFile="SoldierAdd.aspx.cs" Inherits="TownshipEnterprise_SoldierAdd" Title="无标题页" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

    <script type="text/javascript">
        function print() {
            window.open('Print.aspx');

        }
        function OpenWin(url) {
            var h = 480;
            var w = 640;
            var t = (screen.height - h) / 2;
            var l = (screen.width - w) / 2;
            window.open(url, null, 'left=' + l + ",top=" + t + ",width=" + w + ",height=" + h + ",toolbar=yes,scrollbars=yes,status=yes");
        }
    </script>
</asp:Content>


<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <ajaxToolkit:CalendarExtender ID="ceBirth" runat="server" Animated="False" Format="yyyy-MM-dd"
        TargetControlID="Birthday">
    </ajaxToolkit:CalendarExtender>
    <ajaxToolkit:CalendarExtender ID="ceJoinDate" runat="server" Animated="False" Format="yyyy-MM-dd"
        TargetControlID="JoinDate">
    </ajaxToolkit:CalendarExtender>
    <ajaxToolkit:CalendarExtender ID="ceYouthDate" runat="server" Animated="False" Format="yyyy-MM-dd"
        TargetControlID="YouthDate">
    </ajaxToolkit:CalendarExtender>
    <ajaxToolkit:CalendarExtender ID="cePartyDate" runat="server" Animated="False" Format="yyyy-MM-dd"
        TargetControlID="PartyDate">
    </ajaxToolkit:CalendarExtender>
    <ajaxToolkit:FilteredTextBoxExtender ID="ftbHeight" runat="server" FilterType="Numbers"
        TargetControlID="Height">
    </ajaxToolkit:FilteredTextBoxExtender>
    <ajaxToolkit:FilteredTextBoxExtender ID="ftbWeight" runat="server" FilterType="Custom, Numbers"
        TargetControlID="Weight" ValidChars=".">
    </ajaxToolkit:FilteredTextBoxExtender>
    <table border="0" cellpadding="0" cellspacing="0" class="dialog" width="100%">
        <caption>
            <asp:Label ID="ActionTitle" runat="server" Text="新增士兵基本档案"></asp:Label></caption>
        <tr>
            <td>
                <table border="0" cellpadding="4" cellspacing="0" width="100%">
                    <tr>
                        <td width="120">
                            所属地区：
                        </td>
                        <td colspan="3">
                            <%-- <asp:DropDownList ID="ddlDepartment" runat="server">
                            </asp:DropDownList>--%>
                            <asp:UpdatePanel ID="UpdatePanel3" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
                                <ContentTemplate>
                                   
                                    
                                </ContentTemplate>
                                <%--<Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="ddlDepartment" EventName="SelectedIndexChanged" />
                                </Triggers>--%>
                            </asp:UpdatePanel>
                            
                             <asp:DropDownList ID="ddlDepartment" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlDepartment_SelectedIndexChanged"
                                        DataTextField="ShortName" DataValueField="DepartmentID" Width="285px" 
                                        Height="22px">
                                    </asp:DropDownList>
                            
                            <asp:DropDownList ID="ddlSection" runat="server" DataTextField="shortname" DataValueField="DepartmentID"
                                        Width="280px" Height="22px" 
                                        onselectedindexchanged="ddlSection_SelectedIndexChanged" 
                                AutoPostBack="True">
                                    </asp:DropDownList>
                            
                        </td>
                    </tr>
                    <tr>
                        <td width="120">
                            队伍名称：</td>
                        <td colspan="3">
                        <asp:DropDownList ID="ddlTownBasic" runat="server" DataTextField="Army" 
                            DataValueField="ID" Height="22px" Width="90%">
                        </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td width="120">
                            队员编号：
                        </td>
                        <td>
                            <asp:UpdatePanel ID="upnAutoWrite" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">
                                <ContentTemplate>
                                    <asp:TextBox ID="CardID" runat="server" SkinID="textbox_en" Width="80px"></asp:TextBox>
                                    <asp:LinkButton ID="btnAutoWrite" Text="自动分配" runat="server" OnClick="btnAutoWrite_Click" />
                                    <ajaxToolkit:FilteredTextBoxExtender ID="ftbCardID" runat="server" FilterType="Numbers"
                                        TargetControlID="CardID">
                                    </ajaxToolkit:FilteredTextBoxExtender>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="btnAutoWrite" EventName="Click" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </td>
                        <td width="120">
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td>
                            姓名：
                        </td>
                        <td>
                            <asp:TextBox ID="SoldierName" runat="server" SkinID="textbox_cn" Width="180px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="ReqSoldierName" runat="server" ControlToValidate="SoldierName">必需</asp:RequiredFieldValidator>
                        </td>
                        <td>
                            性别：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlSex" runat="server" Width="188px">
                                <asp:ListItem Selected="True">男</asp:ListItem>
                                <asp:ListItem>女</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            民族：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlNation" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                        <td>
                            职务：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlDuty" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            警衔：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlRank" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                        <td>
                            家庭出身：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlBackground" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            籍贯：
                        </td>
                        <td colspan="3">
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">
                                <ContentTemplate>
                                    <asp:DropDownList ID="ddlProvinces" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlProvinces_SelectedIndexChanged"
                                        Width="120px">
                                    </asp:DropDownList>
                                    <asp:DropDownList ID="ddlCities" runat="server" Width="240px">
                                    </asp:DropDownList>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="ddlProvinces" EventName="SelectedIndexChanged" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            本人成分：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlStatus" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                        <td>
                            婚姻状况：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlMerriage" runat="server" Width="188px">
                                <asp:ListItem></asp:ListItem>
                                <asp:ListItem>未婚</asp:ListItem>
                                <asp:ListItem>已婚</asp:ListItem>
                                <asp:ListItem>离异</asp:ListItem>
                                <asp:ListItem>丧偶</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            文化程度：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlCulture" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                        <td>
                            宗教信仰：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlReligion" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            政治面貌：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlPolitical" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                        <td>
                            特长：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlHobby" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            出生日期：
                        </td>
                        <td>
                            <asp:TextBox ID="Birthday" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                        </td>
                        <td>
                            入伍时间：
                        </td>
                        <td>
                            <asp:TextBox ID="JoinDate" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            入团时间：
                        </td>
                        <td>
                            <asp:TextBox ID="YouthDate" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                        </td>
                        <td>
                            入党时间：
                        </td>
                        <td>
                            <asp:TextBox ID="PartyDate" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            入伍所在地：
                        </td>
                        <td colspan="3">
                            <asp:TextBox ID="JoinPlace" runat="server" SkinID="textbox_en" Width="582px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            队员登记表编号：
                        </td>
                        <td>
                            <asp:TextBox ID="RegisterID" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                        </td>
                        <td>
                            入伍批准书编号：
                        </td>
                        <td>
                            <asp:TextBox ID="ConfirmID" runat="server" SkinID="textbox_en" Width="180"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            队员选取表编号：
                        </td>
                        <td colspan="3">
                            <asp:TextBox ID="ChooseID" runat="server" SkinID="textbox_en" Width="582"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            队员注册表编号：
                        </td>
                        <td>
                            <asp:TextBox ID="SGRegNO" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                        </td>
                        <td>
                            队员注册时间：
                        </td>
                        <td>
                            <asp:TextBox ID="SGGegDate" runat="server" SkinID="textbox_en" Width="180px" MaxLength="200"></asp:TextBox>
                            <ajaxToolkit:CalendarExtender ID="SGGegDate_CalendarExtender" runat="server" Enabled="True"
                                TargetControlID="SGGegDate">
                            </ajaxToolkit:CalendarExtender>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            专业一：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlSpeciality1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlSpeciality1_SelectedIndexChanged"
                                Width="188px">
                            </asp:DropDownList>
                        </td>
                        <td>
                            专业二：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlSpeciality2" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            身高：
                        </td>
                        <td>
                            <asp:TextBox ID="Height" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>cm
                        </td>
                        <td>
                            体重：
                        </td>
                        <td>
                            <asp:TextBox ID="Weight" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>kg
                        </td>
                    </tr>
                    <tr>
                        <td>
                            家庭住址：
                        </td>
                        <td colspan="3">
                            <asp:TextBox ID="HomePlace" runat="server" SkinID="textbox_en" Width="582px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            专业训练：
                        </td>
                        <td colspan="3">
                            <asp:TextBox ID="Training" runat="server" SkinID="textbox_en" Width="582px" Rows="4"
                                TextMode="MultiLine"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            奖惩：
                        </td>
                        <td colspan="3">
                            <asp:TextBox ID="Reward" runat="server" SkinID="textbox_en" Width="582px" Rows="4"
                                TextMode="MultiLine"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            入伍后简历：
                        </td>
                        <td colspan="3">
                            <asp:TextBox ID="Resume" runat="server" SkinID="textbox_en" Width="582px" Rows="4"
                                TextMode="MultiLine"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            备注：
                        </td>
                        <td colspan="3">
                            <asp:TextBox ID="Remark" runat="server" SkinID="textbox_en" Width="582px" Rows="4"
                                TextMode="MultiLine"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            照片：
                        </td>
                        <td>
                            <asp:FileUpload ID="fileUpload" runat="server" />
                        </td>
                        <td colspan="2">
                            &nbsp;<asp:CheckBox ID="IsContract" runat="server" Text="是否是合同制" />
                        </td>
                    </tr>
                    <%--<asp:Panel runat="server" ID="Newillpanel">
                        <tr>
                            <td colspan="4">
                                <b>&gt;&gt; 新训成绩</b>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                政治教育：
                            </td>
                            <td>
                                <asp:TextBox ID="PoliticalEducation" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                            </td>
                            <td>
                                消防业务理论：
                            </td>
                            <td>
                                <asp:TextBox ID="OPerationTheory" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                军事队列：
                            </td>
                            <td>
                                <asp:TextBox ID="Queue" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                            </td>
                            <td>
                                业务技能：
                            </td>
                            <td>
                                <asp:TextBox ID="Skill" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                共同条令：
                            </td>
                            <td>
                                <asp:TextBox ID="Ordinance" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                            </td>
                            <td>
                                军事体能：
                            </td>
                            <td>
                                <asp:TextBox ID="Stamina" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                            </td>
                        </tr>
                    </asp:Panel>--%>
                    <tr>
                        <td colspan="4" align="center">
                            <asp:Button ID="btnSave" runat="server" Text="添加" OnClick="btnSave_Click" />
                            <asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="更新" Visible="False" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4" align="center">
                            <asp:Label ID="lblInfo" runat="server" Width="300px"></asp:Label>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <asp:GridView ID="gvSoldiers" runat="server" AutoGenerateColumns="False" Caption="<span>本日最近更新</span>"
        DataKeyNames="SoldierID,TownBasicID" OnRowDeleting="gvSoldiers_RowDeleting">
        <Columns>
            <asp:BoundField DataField="CardID" HeaderText="士兵证号" />
            <asp:TemplateField HeaderText="姓名">
                <ItemTemplate>
                 <%--   <a href="javascript:OpenWin('SoldierView.aspx?ID=<%# Eval("SoldierID") %>');">--%>
                    <a href='SoldierView.aspx?ID=<%# Eval("SoldierID") %> ' target=_blank>
                        <%# Eval("SoldierName")%></a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="TownBasicArmy" HeaderText="单位" />
            <asp:BoundField DataField="Sex" HeaderText="性别" />
            <asp:BoundField DataField="Rank" HeaderText="警衔" />
            <asp:BoundField DataField="Native" HeaderText="籍贯" />
            <asp:TemplateField HeaderText="入伍年月">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Convert.ToDateTime(Eval("JoinTime"))==DateTime.MinValue?"--": Convert.ToDateTime(Eval("JoinTime")).ToString("yyyy.MM") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:HyperLinkField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                DataNavigateUrlFields="SoldierID" DataNavigateUrlFormatString="SoldierAdd.aspx?ID={0}"
                HeaderText="编辑" Text="&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;../../Images/Edit.gif&quot;/&gt;" />
            <%--<asp:HyperLinkField DataNavigateUrlFields="SoldierID" DataNavigateUrlFormatString="SoldierView.aspx?ID={0}"
                HeaderText="查看" Text="&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;../../Images/UserView.gif&quot;/&gt;" />--%>
            <%--<asp:HyperLinkField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" DataNavigateUrlFields="SoldierID" DataNavigateUrlFormatString="~/Police/TransfeSoldier.aspx?ID={0}"
                HeaderText="调动" Text="&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;../../Images/TransfSolider.gif&quot;/&gt;" />--%>
            <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                HeaderText="删除">
                <ItemTemplate>
                    <asp:ImageButton ID="delteImage" ImageUrl="~/Images/delete.gif" OnClientClick="return confirm('您确认删除此兵员记录吗？')"
                        CommandName="Delete" runat="server" CausesValidation="false" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <HeaderStyle HorizontalAlign="Left" />
        <RowStyle HorizontalAlign="Left" />
    </asp:GridView>
</asp:Content>

